<template>
  <a-card :bordered="false">
    <component @onEdit="handleEdit"  @onGoBack="handleGoBack" :record="record"
               :is="currentComponet"></component>
  </a-card>
</template>

<script>
  import Edit from './Edit'
  import  List from  './List'
  export default {
    name: 'info',
    components:{
      Edit,
      List
    },
    data() {
      return {
        currentComponet: 'List',
        record: ''
      }
    },
    methods:{
      handleEdit(record) {
        if(record=='null'){ //新建
          this.record = ''
        }else {
          this.record = record
        }

        this.currentComponet = 'Edit'
      },
      handleGoBack() {
        this.record = ''
        this.currentComponet = 'List'
      },

    },
    watch: {
      '$route.path'() {
        this.record = ''
        this.currentComponet = 'List'
      }
    }
  }
</script>

<style scoped>

</style>